package com.yy.wga.pay.service.manager;

import com.yy.wga.common.utils.mapping.BeansUtils;
import com.yy.wga.pay.feign.request.third.WechatTransferNotifyDecodeRequest;
import com.yy.wga.pay.service.event.TransferCallbackEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

/**
 * @author hongfeng
 * @date 2021/5/25
 * @desc
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class TransferCallbackManagerService {

    private final ApplicationEventPublisher eventPublisher;

    /**
     * 微信回调
     * @param transferNotifyDecodeRequest
     */
    public void wechatNotify(WechatTransferNotifyDecodeRequest transferNotifyDecodeRequest) {
        // 支付回调
        TransferCallbackEvent transferCallbackEvent = BeansUtils.map(transferNotifyDecodeRequest, TransferCallbackEvent.class);
        eventPublisher.publishEvent(transferCallbackEvent);
    }
}
